package com.cvit.cn.service;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.cvit.cn.bean.SupplierInfo;
import com.cvit.cn.dao.SupplierInfoMapper;
import com.cvit.cn.test.UuidUtil;

@Service
public class SupplierInfoService {
	
	@Autowired
	SupplierInfoMapper supplierInfoMapper;

	/*
	 * 添加供应商
	 */
	public int addSupplierInfo(SupplierInfo supplierInfo){
		return supplierInfoMapper.insert(supplierInfo);
	}

	/*
	 * 删除供应商
	 */
	
	public int delSupplierInfo(String[] ids){
		return supplierInfoMapper.delSupplierInfo(ids);
	}

	/*
	 * 修改供应商
	 */
	public int updateSupplierInfo(SupplierInfo updateSupplierInfo) {
		//通过id修改
		return supplierInfoMapper.updateByPrimaryKey(updateSupplierInfo);
	}
	

	/*
	 * 查询供应商
	 */
	public List<SupplierInfo> selectSupplierInfo() {
		return supplierInfoMapper.selectSupplierInfo();
	}

	/*
	 * 假删除供应商
	 */
	public int delSupplierInfoFalse(String[] ids) {
		return supplierInfoMapper.delSupplierInfoFalse(ids);
	}
	//------根据Id查询供应商
	public List<SupplierInfo> selectByPrimaryKey(String id){
		return supplierInfoMapper.selectByPrimaryKey(id);
	}
	//------模糊查询
		public List<SupplierInfo> selectBySupplierName(String supplierName){
			return supplierInfoMapper.selectBySupplierName(supplierName);
		}
	/**
	 * 根据供应商ID查所有数据
	 */
	public List selectByInfoIdAll(String id){
		return supplierInfoMapper.selectByInfoIdAll(id);
	}

	public List<SupplierInfo> addVendorsById(String id) {
		// TODO Auto-generated method stub
		return supplierInfoMapper.seleByqq(id);
	}

	/**
	 * 根据supplierEmail给flag赋值为1
	 * */
	public void updateFlag(SupplierInfo si) {
		// TODO Auto-generated method stub
		supplierInfoMapper.updateFlag(si);
	}

	public void deleSupplier(String id) {
		// TODO Auto-generated method stub
		supplierInfoMapper.deleteByPrimaryKey(id);
	}

}
